import request from '@/utils/request'

export function getAccountUsableList(query) {
  let baseUrl = "/marketing/account"
  if(query != undefined){
    if(typeof query == "object"){
      console.log(query)
      if(query.hasOwnProperty('accountID')){
        query['accountID'] = parseInt(query['accountID'])
        if(isNaN(query['accountID']) == false){
          baseUrl = baseUrl+"-"+query['accountID']
        }
      }
    }
  }
  return request({
    url: baseUrl,
    method: 'get'
  })
}

export function getAccountList(query) {
  return request({
    url: '/marketing/admin/account/getList',
    method: 'post',
    data: query
  })
}
export function saveAccount(query) {
  return request({
    url: '/marketing/admin/account/save',
    method: 'post',
    data: query
  })
}

export function removeAccount(query) {
  return request({
    url: '/marketing/admin/account/remove',
    method: 'post',
    data: query
  })
}
export function getAccountDetail(accountID) {
  return request({
    url: '/marketing/admin/account/info/'+accountID,
    method: 'get',
    data: query
  })
}